<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:tree="http://www.CrossFactory.net/Tree">
	<xsl:output method='xml' version='1.0'/>
	
	<xsl:param name="tree:types"/>
	
	<xsl:param name="tree:serviceUrl"/>
	<xsl:param name="tree:applicationPath"/>
	<xsl:param name="tree:xslFile"/>
	<xsl:param name="tree:xmlFile"/>
	<xsl:param name="tree:serverUrl"/>
	<xsl:param name="tree:controlPath"/>
	<xsl:param name="tree:imagePath"/>
	<xsl:param name="tree:hasParent"/>
	<xsl:param name="tree:allowPositionSelection"/>
	<xsl:param name="tree:waitInit"/>
	<xsl:param name="tree:isRoot"/>

	<xsl:template match='*'/>
	
	<xsl:template match='/'>
		<xsl:apply-templates select="children/treeNode"></xsl:apply-templates>
	</xsl:template>
	
	<xsl:template match="treeNode">
		<xsl:if test="$tree:allowPositionSelection = 'true' and position()=1 and type != 'Website' and type != 'website'">
			<table border="0" cellspacing="0" cellpadding="0" id="{id}_before" fromClient="{$tree:hasParent}" hasChildren="no" style="behavior:url({$tree:applicationPath}{$tree:controlPath}TreeItem.htc);">
				<tr height="6" id="{id}_before2">	
				<xsl:attribute name="selection">
					<xsl:value-of select="selectionMode" />
				</xsl:attribute>
					<td height="6" width="19">
						<img src="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/smallT.gif" height="6" width="19"/>
					</td>
					<td id="{id}_before21" height="6" width="40" background="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/smallr.gif">
						<xsl:attribute name="class">
							<xsl:value-of select="$tree:types/treeType[name = current()/type]/className"/>
						</xsl:attribute>
						<xsl:attribute name="defaultClassName">
							<xsl:value-of select="$tree:types/treeType[name = current()/type]/className"/>
						</xsl:attribute>
						<xsl:attribute name="overClassName">
							<xsl:value-of select="$tree:types/treeType[name = current()/type]/overClassName"/>
						</xsl:attribute>
						<xsl:attribute name="selectedClassName">
							<xsl:value-of select="$tree:types/treeType[name = current()/type]/selectedClassName"/>
						</xsl:attribute>
						<xsl:attribute name="selectedOverClassName">
							<xsl:value-of select="$tree:types/treeType[name = current()/type]/selectedOverClassName"/>
						</xsl:attribute>
						<img src="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/white.gif" border="0" height="6" width="40"/>
					</td>
					<td width="100%">
						<img src="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/transp.gif" width="100%" height="6"/>
					</td>
					<td id="{id}_before4"></td>
				</tr>
			</table>
		</xsl:if>
		<table test="{type}" id="{id}" dataItem="{dataItem}" fromClient="{$tree:hasParent}" hasChildren="{hasChildren}" border='0' cellpadding='0' cellspacing='0' style="behavior:url({$tree:applicationPath}{$tree:controlPath}TreeItem.htc);">
			<xsl:if test="dragId">
				<xsl:attribute name="dragId">
					<xsl:value-of select="dragId" />
				</xsl:attribute>
			</xsl:if>
			<tr>
				<td id="{id}1">
						<xsl:choose>
							<xsl:when test="hasChildren = 'yes'">
								<xsl:attribute name="style">cursor:hand;</xsl:attribute>
								<xsl:choose>
									<xsl:when test="name(..) = 'children' and $tree:isRoot = 'yes'">
										<img width="19" height="20" src="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/Rplus.gif"></img>
									</xsl:when>
									<xsl:when test="position()=last() and position()=1 and not(isRootNode) and $tree:allowPositionSelection != 'true'">
										<img width="19" height="20" src="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/Lplus.gif"></img>
									</xsl:when>
									<xsl:when test="position()=last() and position()!=1 and not(isRootNode) and $tree:allowPositionSelection != 'true'">
										<img width="19" height="20" src="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/Lplus.gif"></img>
									</xsl:when>
									<xsl:otherwise>
										<img width="19" height="20" src="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/Tplus.gif"></img>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:when>
							<xsl:otherwise>
								<xsl:choose>
									<xsl:when test="position()=last() and position()=1 and $tree:allowPositionSelection != 'true'">
										<img width="19" height="20" src="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/L.gif"></img>
									</xsl:when>
									<xsl:when test="position()=last() and position()!=1 and $tree:allowPositionSelection != 'true'">
										<img width="19" height="20" src="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/L.gif"></img>
									</xsl:when>
									<xsl:otherwise>
										<img width="19" height="20" src="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/T.gif"></img>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:otherwise>
						</xsl:choose>
				</td>
				<td id="{id}2">
				<xsl:attribute name="selection">
					<xsl:value-of select="selectionMode" />
				</xsl:attribute>
				<table width="19" height="20" border='0' cellpadding='0' cellspacing='0'>
				<tr>
				<td>
					<xsl:if test="$tree:types/treeType[name = current()/type]/image">
					<img width="19" height="20">
						<xsl:attribute name="src">
							<xsl:value-of select="$tree:imagePath" />
							<xsl:value-of select="$tree:types/treeType[name = current()/type]/image"/>
						</xsl:attribute>
					</img>
					</xsl:if>
				</td>
				<td id="{id}21">
				<xsl:attribute name="class">
					<xsl:value-of select="$tree:types/treeType[name = current()/type]/className"/>
				</xsl:attribute>
				<xsl:attribute name="defaultClassName">
					<xsl:value-of select="$tree:types/treeType[name = current()/type]/className"/>
				</xsl:attribute>
				<xsl:attribute name="overClassName">
					<xsl:value-of select="$tree:types/treeType[name = current()/type]/overClassName"/>
				</xsl:attribute>
				<xsl:attribute name="selectedClassName">
					<xsl:value-of select="$tree:types/treeType[name = current()/type]/selectedClassName"/>
				</xsl:attribute>
				<xsl:attribute name="selectedOverClassName">
					<xsl:value-of select="$tree:types/treeType[name = current()/type]/selectedOverClassName"/>
				</xsl:attribute>
				
				<nobr><xsl:value-of select="label" /></nobr>
				</td>
				</tr>
				</table>
				</td>
			</tr>
			<tr test="{type}">
				<xsl:choose>
					<xsl:when test="position()=last() and $tree:allowPositionSelection != 'true'">
						<td id="{id}3" style="display:;"></td>
					</xsl:when>
					<xsl:when test="position()=last() and $tree:allowPositionSelection = 'true' and type != 'Website' and type != 'website'">
						<td id="{id}3" background="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/i.gif" style="display:;"></td>
					</xsl:when>
					<xsl:when test="position()=last() and $tree:allowPositionSelection = 'true' and (type = 'Website' or type = 'website')">
						<td id="{id}3" style="display:;"></td>
					</xsl:when>
					<xsl:otherwise>
						<td id="{id}3" background="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/i.gif" style="display:;"></td>
					</xsl:otherwise>
				</xsl:choose>
				<td id="{id}4" style="display:none;">
					<xsl:apply-templates select="treeNode"></xsl:apply-templates>
				</td>
			</tr>
		</table>
		<xsl:if test="$tree:allowPositionSelection = 'true' and type != 'Website' and type != 'website'">
			<table border="0" cellspacing="0" cellpadding="0" fromClient="{$tree:hasParent}" id="{id}_after" style="behavior:url({$tree:applicationPath}{$tree:controlPath}TreeItem.htc);" hasChildren="no">
				<tr height="6" id="{id}_after2">
				<xsl:attribute name="selection">
					<xsl:value-of select="selectionMode" />
				</xsl:attribute>	
					<td height="6" width="19">
						<img src="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/smallL.gif" height="6" width="19"/>
					</td>
					<td id="{id}_after21" height="6" width="40" background="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/smallr.gif">
						<xsl:attribute name="class">
							<xsl:value-of select="$tree:types/treeType[name = current()/type]/className"/>
						</xsl:attribute>
						<xsl:attribute name="defaultClassName">
							<xsl:value-of select="$tree:types/treeType[name = current()/type]/className"/>
						</xsl:attribute>
						<xsl:attribute name="overClassName">
							<xsl:value-of select="$tree:types/treeType[name = current()/type]/overClassName"/>
						</xsl:attribute>
						<xsl:attribute name="selectedClassName">
							<xsl:value-of select="$tree:types/treeType[name = current()/type]/selectedClassName"/>
						</xsl:attribute>
						<xsl:attribute name="selectedOverClassName">
							<xsl:value-of select="$tree:types/treeType[name = current()/type]/selectedOverClassName"/>
						</xsl:attribute>
						<img src="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/white.gif" border="0" height="6" width="40"/>
					</td>
					<td width="100%">
						<img src="{$tree:serverUrl}{$tree:applicationPath}{$tree:controlPath}Images/transp.gif" width="100%" height="6"/>
					</td>
					<td id="{id}_after4"></td>
				</tr>
			</table>
		</xsl:if>
	</xsl:template>
		
</xsl:stylesheet>